<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:a4j="http://richfaces.org/a4j"
	template="/pages/templates/templateMain.xhtml">

	<ui:param name="browser_tab_title" value="Bundle Details" />
	<ui:param name="page_title" value="Bundle Details" />

	<ui:define name="content">

		<h:form>
			<p:commandButton value="Back" ajax="false"
				action="#{bundleListBean.back}" />
		</h:form>

		<br />
		<br />

		<p:tabView>
			<p:tab title="Basic">
				<p:panel styleClass="modal-info-panel">
					<f:facet name="header">
						<h:outputText value="Bundle data" />
					</f:facet>
					<h:panelGrid columns="2">
						<h:outputLabel value="Symbolic name" />
						<h:outputText value="#{bundle.bundleData.symbolicName}" />

						<h:outputLabel value="Presentation name" />
						<h:outputText value="#{bundle.bundleData.presentationName}" />

						<h:outputLabel value="Version" />
						<h:outputText value="#{bundle.bundleData.version}" />

						<h:outputLabel value="Repository" />
						<h:outputText value="#{bundle.bundleData.repository.name}" />

						<h:outputLabel value="URL" />
						<h:outputText value="#{bundle.bundleData.url}" />

						<h:outputLabel value="Upload time" />
						<h:outputText value="#{bundle.bundleData.uploadTime}">
							<f:convertDateTime type="date" />
						</h:outputText>
					</h:panelGrid>
				</p:panel>

				<p:panel styleClass="modal-info-panel">
					<f:facet name="header">
						<h:outputText value="Maven" />
					</f:facet>
					<h:panelGrid columns="2">
						<h:outputLabel value="Group ID" />
						<h:outputText value="#{bundle.bundleData.groupId}" />

						<h:outputLabel value="Artifact ID" />
						<h:outputText value="#{bundle.bundleData.artifactId}" />
					</h:panelGrid>
				</p:panel>
			</p:tab>

			<p:tab title="Capablities">
				<p:dataTable value="#{bundle.bundleData.capabilities}"
					var="capability" emptyMessage="Bundle has no capabilities"
					style="width: 100%">
					<p:column>
						<f:facet name="header">
							<h:outputText value="Package" />
						</f:facet>
						<h:outputText value="#{capability.packageName}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="Version" />
						</f:facet>
						<h:outputText value="#{capability.version}" />
					</p:column>
				</p:dataTable>
			</p:tab>

			<p:tab title="Requirements">
				<p:dataTable value="#{bundle.bundleData.requirements}"
					var="requirement" emptyMessage="Bundle has no requirements"
					style="width: 100%">
					<p:column>
						<f:facet name="header">
							<h:outputText value="Filter" />
						</f:facet>
						<h:outputText value="#{requirement.filter}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="Extend" />
						</f:facet>
						<h:outputText value="#{requirement.extend}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="Multiple" />
						</f:facet>
						<h:outputText value="#{requirement.multiple}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="Optional" />
						</f:facet>
						<h:outputText value="#{requirement.optional}" />
					</p:column>
				</p:dataTable>
			</p:tab>

			<p:tab title="Resources">
				<h:form id="fileUploadForm">
					<rich:fileUpload
						fileUploadListener="#{resourceUtil.uploadListener}"
						noDuplicate="true" allowFlash="true" listWidth="600px"
						maxFilesQuantity="20">
						<a4j:support event="onuploadcomplete" reRender="resourcesPanel" />
						<a4j:support event="onclear" reRender="fileUploadForm" />
					</rich:fileUpload>
				</h:form>

				<rich:spacer />

				<h:panelGroup id="resourcesPanel">
					<ui:include src="/pages/resource/resourceDataTable.xhtml">
						<ui:param name="resourceList" value="#{bundle.resources}" />
					</ui:include>
				</h:panelGroup>

			</p:tab>
		</p:tabView>

	</ui:define>

</ui:composition>